package com.haoshuang.zhouzhoubang.ui.page.mine.wallet.frozen.detail

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.DJDetailBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.ResponseBean
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class FrozenAmountDetailViewModel : BaseViewModel() {

    /**
     * 冻结保证金明细
     */
    val getDepositDetailData = StatefulMutableLiveData<ResponseBean<DJDetailBean>>()
    fun getDepositDetail(id: String) = netRequest {
        start { getDepositDetailData.value = StateData.Loading }
        request { ApiRepo.getDepositDetail(id)  }
        success { getDepositDetailData.value = StateData.Success(it) }
        error { code, msg ->
            getDepositDetailData.value = StateData.Error(code, msg)
        }
    }
}